﻿<Window x:Class="InfFront.InfoViews.WPF.ErrorDialog"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:InfFront.InfoViews.WPF"
    x:Name="ThisWindow"
    Title="Application Error" WindowStartupLocation="CenterOwner" ResizeMode="NoResize"
    ShowInTaskbar="False" Width="400"  MinWidth="400" SizeToContent="Height"
    SizeChanged="ThisWindow_SizeChanged"
    >

    <Window.Resources>
        <local:IconedObjectToNormal16x16ImageConverter x:Key="getNormal16x16Image"/>
        <local:BoolToVisibilityConverter x:Key="boolToVisibility"/>
    </Window.Resources>

    <Window.Icon>
        <Binding Converter="{StaticResource getNormal16x16Image}" />
    </Window.Icon>
    
    <Window.Background>
        <LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
            <GradientStop Offset="0" Color="{Binding Path=VisualSettings.PrimaryBackgroundColor, FallbackValue=Lavender}"/>
            <GradientStop Offset="1" Color="{Binding Path=VisualSettings.SecondaryBackgroundColor, FallbackValue=Azure}"/>
        </LinearGradientBrush>
    </Window.Background>

    <Grid x:Name="mainPanel">        
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" MinHeight="75"/>
            <RowDefinition x:Name="rdDetails" Height="150*" MaxHeight="250" />
        </Grid.RowDefinitions>

        <Grid Grid.Row="0" Margin="4">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>
            <WrapPanel Grid.Row="0" Margin="4">
                <Image Height="32" Width="32" Source="/InfFront.InfoViews.WPF;component/Resources/x32.bmp" />
                <TextBlock x:Name="tbBoldMessage" Text="Unknown error"
                           Margin="10" FontWeight="Bold" VerticalAlignment="Center" TextWrapping="Wrap" />                
            </WrapPanel>
            <WrapPanel Grid.Row="1" Margin="4" HorizontalAlignment="Right" VerticalAlignment="Bottom">
                <CheckBox x:Name="cbShowDetails"
                      Unchecked="cbShowDetails_Checked" Checked="cbShowDetails_Checked" VerticalAlignment="Center">Show details</CheckBox>
                <Button Margin="20,0,0,0" Height="Auto" Padding="12,4" Click="btnClose_Click">Close</Button>
            </WrapPanel>
        </Grid>
        <TextBox x:Name="tbDetails" Grid.Row="1"
                 Visibility="{Binding ElementName=cbShowDetails, Path=IsChecked, Converter={StaticResource boolToVisibility}}"
                 HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" 
                 IsReadOnly="True" Margin="4,2">
            <TextBox.Background>
                <SolidColorBrush Color="{Binding Path=VisualSettings.SecondaryBackgroundColor, FallbackValue=Azure}" />
            </TextBox.Background>
            Please contact the adminstrator with the following information:
        </TextBox>
    </Grid>
</Window>
